home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
CFUNCTS.LZH
/
RND.C
< prev
next >
Wrap
Text File
|
1986-06-09
|
520b
|
33 lines
#include <stdio.h>
#include <stdlib.h>
main(nargs,arg)
int nargs;
char *arg[];
{
int max;
int a;
int z;
if (nargs != 2)
printf("usage rnd(max no)\n");
else {
max = *arg[1] - '0';
printf("max = %d\n",max);
for (a = 0; a < 15; ++a) {
z = rnd(max);
printf("%d\n",z);
}
}
}
rnd(lim)
int lim;
{
int op;
int no;
op = 32768/lim;
no = (rand()/op)+1;
return(no);
}